import request from "@/netword/request";


const fun = {};


// 分页查询所有信息
fun.getList = async (swiper) => {
    const res = await request({
        url: "/a/content/swiper/list",
        method: "post",
        params: {
            swiperName: swiper.swiperName,
            pageNo: swiper.pageNo,
            pageSize: swiper.pageSize,
        }
    })
    return res.data;
}



//保存数据
fun.saveSwiper = async (swiper) => {
    const res = await request({
        url: "/a/content/swiper/save",
        method: "put",
        params: {
            swiperName:swiper.swiperName,
            swiperAddress:swiper.swiperAddress,
            sort: swiper.sort,
            remarks: swiper.remarks,
        }
    })
    return res.data;
}



//更新数据
fun.updateSwiper = async (swiper) => {
    const res = await request({
        url: "/a/content/swiper/update",
        method: "post",
        params: {
            id: swiper.id,
            swiperName:swiper.swiperName,
            swiperAddress:swiper.swiperAddress,
            sort: swiper.sort,
            remarks: swiper.remarks,
        }
    })
    return res.data;
}



//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/content/swiper/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//查询单条数据
fun.getSwiper = async (id) => {
    const res = await request({
        url: "/a/content/swiper/get",
        method: "get",
        params: {
            id: id
        }
    })
    return res.data;
}


export default fun;